{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Intro to Graphics\n", "\n", "This notebook gives an overview on basic plots, charts, and graphs in Python. It requires knowledge of `pandas` `DataFrame`s covered in \"Intro to Pandas and Table Visualization.ipynb\"." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Required Imports\n", "\n", "We will need to import `pandas` as usual. But here since we will need to do plotting, there is a specific command we need to run at the beginning of the notebook: `%matplotlib inline`. This basically allows the graphics to be displayed in the notebook. The `matplotlib` part comes because `pandas` uses `matplotlib` under the hood to generate its plots." ] }, { "cell_type": "code", "execution_count": 4, "metadata": {}, "outputs": [], "source": [ "import pandas as pd\n", "%matplotlib inline" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Plotting with Pandas" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Let's quickly set up a `DataFrame` with some data so we can create some plots from it. " ] }, { "cell_type": "code", "execution_count": 5, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", " | Values | \n", "t | \n", "
---|---|---|
0 | \n", "100.12 | \n", "1 | \n", "
1 | \n", "110.50 | \n", "2 | \n", "
2 | \n", "105.20 | \n", "3 | \n", "
3 | \n", "106.70 | \n", "4 | \n", "
4 | \n", "110.20 | \n", "5 | \n", "
5 | \n", "98.50 | \n", "6 | \n", "
6 | \n", "94.20 | \n", "7 | \n", "
7 | \n", "91.10 | \n", "8 | \n", "
8 | \n", "93.12 | \n", "9 | \n", "
9 | \n", "94.02 | \n", "10 | \n", "
10 | \n", "92.17 | \n", "11 | \n", "